﻿using KernelSyntaxExample.Utils;
using Microsoft.SemanticKernel;

namespace SemanticKernelBlazorDemo.Shared.Services;

public class GPTEvaluateService : IGPTEvaluateService
{
    private IKernel _kernel;

    public GPTEvaluateService(IKernelFactory kernelFactory)
    {
        _kernel = kernelFactory.Produce();
    }

    public string EvaluateAsync(string input)
    {
        var keyAnalysisSkill =
            _kernel.ImportSemanticSkillFromDirectory(
                ProjectFile.GetSkillsFolder(), "KeyAnalysisSkill");
        return _kernel.RunAsync(input, keyAnalysisSkill["Evaluate"]).Result.ToString();
    }
}

